<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<title>个人中心</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link type="text/css" rel="stylesheet" href="css/bootstrap.css">
	<link type="text/css" rel="stylesheet" href="css/style.css">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/simpleCart.min.js"></script>
</head>
<style>
	.pwInput{
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
		box-sizing: border-box;
		margin: 0;
		font: inherit;
		color: inherit;
		font-family: inherit;
		line-height: inherit;
		border: 1px solid #555;
		outline-color: #FD9F3E;
		width: 96%;
		font-size: 1em;
		padding: 0.5em;
	}
</style>
<body>

	<jsp:include page="header.jsp"/>
	
	<!--account-->
	<div class="account">
		<div class="container">
			<div class="register">
				<c:if test="${msg!=null}"><div class="alert alert-danger">${msg}</div></c:if>
				<form action="my" method="post" onsubmit="return checkpassword()">
					<input type="hidden" name="id" value="${user.id}">
					<div class="register-top-grid">
						<h3>个人中心</h3>
						
						<h4>收货信息</h4>
						<div class="input">
							<span>收货人<label></label></span>
							<input type="text" name="name" value="${user.name}" placeholder="请输入收货"> 
						</div>
						<div class="input">
							<span>收货电话</span>
							<input type="text" name="phone" value="${user.phone}" placeholder="请输入收货电话"> 
						</div>
						<div class="input">
							<span>收货地址</span>
							<input type="text" name="address" value="${user.address}" placeholder="请输入收货地址"> 
						</div>
						<div class="register-but text-center">
						   <input type="submit" value="提交">
						</div>	
						<hr>
						<h4>安全信息</h4>
						<div class="input">
							<span>原密码</span>
							<input class="pwInput" type="password" name="password" placeholder="请输入原密码">
						</div>
						<div class="input">
							<span>新密码</span>
							<input class="pwInput" id="pwNew1" type="password" name="passwordNew" placeholder="请输入新密码">
						</div>
						<div class="input">
							<span>确认新密码</span>
							<input class="pwInput" id="pwNew2" type="password" name="passwordNew2" placeholder="请再一次输入新密码">
						</div>
						<div class="clearfix"> </div>
						<div class="register-but text-center">
						   <input type="submit" value="提交">
						</div>	
					</div>
				</form>
				<div class="clearfix"> </div>
			</div>
	    </div>
	</div>
	<!--//account-->

	<jsp:include page="footer.jsp"/>
	<script>
		function checkpassword(){
			var i1 = document.getElementById("pwNew1");
			var p1 = i1.value;
			var i2 = document.getElementById("pwNew2");
			let p2 = i2.value;
			if (p1===p2){
				return true;
			}
			alert("两次输入的新密码不匹配，请确认新密码");
			return false;
		}
	</script>
</body>
</html>